<template>
  <div>
    <!-- 面包屑导航区 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/wellcome' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>

    <!-- 卡片视图区域 -->
    <el-table :data="rihgtsList" stripe style="width: 100%" border>
        <el-table-column type="index"></el-table-column>
        <el-table-column prop="authName" label="权限名称">
        </el-table-column>
        <el-table-column prop="path" label="路径">
        </el-table-column>
        <el-table-column prop="level" label="权限等级">
            <template v-slot:default="slot">
                <el-tag v-if="slot.row.level === '0'" >标签一</el-tag>
                <el-tag v-else-if="slot.row.level === '1'" type="success">标签二</el-tag>
                <el-tag v-else type="warning">标签三</el-tag>
            </template>
        </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
    name:'Rights',
    data(){
        return {
            rihgtsList:[],
        }
    },
    created(){
        this.getRightsList();
    },
    methods:{
        async getRightsList(){
            const res = await this.axios.get('rights/list');
            const {data} = res.data;
            const {status} = res.data.meta;
            if(status !== 200) return this.$message.error('获取权限失败~')
            this.rihgtsList = data;
            // console.log(data);
        }
    }
}
</script>

<style>

</style>